<php>
    $pPrice = D('appstore_price')->where(array('version_id'=>$version['id'],'pid'=>0))->order('id asc')->select();
</php>

<link href="__CSS__/version.css" rel="stylesheet">

<div id="price_div" style="<if condition="$version['need_buy']">display:block<else/> display:none</if> " >


<a href="javascript:" class="btn btn-info" data-role="add_parent">添加方案</a>

<ul class="version-ul">


    <php>foreach($pPrice as $pkey => $pVal){</php>

    <li class="clearfix">
        <div class='pull-left i-list'>
            <select name="price[value][]" class="form-control pull-left" style="width: 100px;">
                <volist name="score" id="vo">
                    <option value="{$vo.id}" <if condition="$vo['id'] eq $pVal['value']">selected</if>>{$vo.title}</option>
                </volist>
            </select>
            <input name="price[price][]" placeholder="" class="form-control" style="width: 100px;" value="{$pVal['price']}">

            <input name="price[price_type][]" type="hidden" value="price">
            <input name="price[is_parent][]" type="hidden" value="1">

        </div>
        <div class="pull-left handle_div">
            <a href="javascript:" title="删除" data-role="del_li"><i class="icon icon-remove"></i></a>
            <a href="javascript:" title="添加折扣方案" data-role="add_child"><i class="icon icon-sitemap"></i></a>
        </div>


        <php>$cPrice = D('appstore_price')->where(array('pid'=>$pVal['id']))->select();
            if($cPrice){
        </php>
        <div class="clearfix"></div>

        <ul class="child-ul">

            <volist name="cPrice" id="cVal">
                <li class="clearfix">
                    <div class='pull-left'>
                        <select name="price[value][]" class="form-control pull-left" style="width: 100px;">
                            <volist name="roles" id="role">
                                <option value="{$role.id}" <if condition="$role['id'] eq $cVal['value']">selected</if> >{$role.title}</option>
                            </volist>
                        </select>

                        <select name="price[price_type][]" class="form-control pull-left" style="width: 100px;">
                            <option value="rebate" <if condition="'rebate' eq $cVal['price_type']">selected</if> >打折</option>
                            <option value="price" <if condition="'price' eq $cVal['price_type']">selected</if>>定价</option>
                        </select>
                        <input name="price[price][]" placeholder="" class="form-control" style="width: 100px;" value="{$cVal['price']}">
                        <input name="price[is_parent][]" type="hidden" value="0">
                    </div>
                    <div class="pull-left handle_div">
                        <a href="javascript:" title="删除" data-role="del_li"><i class="icon icon-remove"></i></a>
                    </div>
                </li>
            </volist>
        </ul>

        <php>}</php>


    </li>


    <php> }</php>


</ul>

</div>


<script src="__JS__/version.js"></script>